package com.example.hps.greendaotest.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.example.hps.greendaotest.R;
import com.example.hps.greendaotest.dao.UserHelper;
import com.example.hps.greendaotest.entity.User;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        UserHelper userHelper = UserHelper.getInstance(this);

        User user = new User(1L, "张三", 20);

        long id = userHelper.insert(user);
        Toast.makeText(this, "Id = " + id, Toast.LENGTH_SHORT).show();
    }
}
